package easycloud.ecs.provider.baidu.model;

import java.util.Date;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.baidu.inf.iis.bcs.model.ObjectSummary;

import easycloud.ecs.api.model.IStorageObjectSummary;

public class BaiduStorageObjectSummary implements IStorageObjectSummary {

	private ObjectSummary objectSummary;

	public BaiduStorageObjectSummary(ObjectSummary objectSummary) {
		this.objectSummary = objectSummary;
	}

	@Override
	public String getETag() {
		// TODO this is a bug
		return objectSummary.getVersionKey();
	}

	@Override
	public String getKey() {
		return objectSummary.getName();
	}

	@Override
	public Date getLastModified() {
		return new Date(objectSummary.getLastModifiedTime());
	}

	@Override
	public long getSize() {
		return objectSummary.getSize();
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
